package com.aids_malaria.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.aids_malaria.R;
import com.aids_malaria.base.BaseQuickAdapter;
import com.aids_malaria.base.BaseViewHolder;
import com.aids_malaria.http.response.PersonData;

import java.util.List;

public class PersonSelectAdapter extends BaseQuickAdapter<PersonData> {

    public PersonSelectAdapter(Context context, int layoutResID, List<PersonData> data) {
        super(context, layoutResID, data);
    }

    @Override
    public void convert(BaseViewHolder holder, PersonData item) {
        if (holder.getAdapterPosition() % 2 > 0){
            holder.getView(R.id.item).setBackgroundColor(mContext.getResources().getColor(R.color.c_item2));
        }else {
            holder.getView(R.id.item).setBackgroundColor(mContext.getResources().getColor(R.color.c_item1));
        }

        String residential_village_name = item.getResidential_village_name();
        holder.setText(R.id.tv_village_name, !TextUtils.isEmpty(residential_village_name) ? residential_village_name : item.getResidential_county_name());
        holder.setText(R.id.tv_people_name,item.getName());
        holder.setText(R.id.tv_id_num,item.getIdentity_code());
    }
}
